# 测试
# 输出参数和参数类型
def printAndType(item):
    print("值：", item, "类型是", type(item))


# str = "String"
# num = 100
#
# printAndType(str)
# printAndType(str[2:]*2)
# printAndType("dd:\a")   #转义
# printAndType(r"dd:\a")   #反转义
# printAndType(num)
# printAndType(locals())


# aList = [1, "str", 2]  # list
# printAndType(aList[1:2])
# printAndType(aList[1:] + aList[1:2])

# 元组 tuple
# tuple = (123, "hello world", aList)
# aList.append("hello")
# printAndType(tuple)
# printAndType(tuple+tuple)

# set 集合
# aSet = {"hello", "world"}
# aSet2 = set('str')  # 以单个字符的形式读入

# printAndType(aSet)
# printAndType(aSet2)

# dicr 字典:map
# aDict = {}
# aDict[1] = "菜鸟教程"
# aDict[2] = "世界教程"
# printAndType(aDict)

# 快速生成键值对
# printAndType(dict([('Runoob', 1), ('Google', 2), ('Taobao', 3)]))

# 列表 ： []
# 元组 ： ()    不可修改
# 集合 ： {}    不可重复
# 字典 ： {}    键值对

# 推导式
# a2List = [i for i in range(20) if i % 3 == 0]
# printAndType(a2List)
#
# strList = ["Google", "Runoob", "Taobao"]
#
# lenDict = {key: len(key) for key in strList}
# printAndType(lenDict)
#
#
# xy = 1
# printAndType(f"{xy*2+1=}")      # = 拼接表达式和结果


import operator

# a = [1, 2]
# b = [2, 3]
# c = [2, 3]
# print(f"{operator.eq(a,b) = }")
# print(f"{operator.eq(b,c) = }")


a, b = 0, 1
for i in range(10):
    print(i,":",b)
    # print(f"{id(a)=},{id(b)=}")
    a,b = b,a+b     #同时计算 |  同时赋值
#
# c  = 10
# while c < 20:
#     print(c)
#     c += 1
# else:       #无意义的 else
#     print("else",c)

# for i in range(10):
# for i in "hello":
#     print(i)

# for letter in 'Runoob':
#     if letter == 'o':
#         pass
#         print('执行 pass 块')
#     print('当前字母 :', letter)
#
# print("Good bye!")


# class MyNumbers:
#     def __iter__(self):
#         self.a = 1
#         return self
#
#     def __next__(self):
#         x = self.a
#         self.a += 1
#         return x
#
#
# myclass = MyNumbers()
# myiter = iter(myclass)
#
# print(next(myiter))
# print(next(myiter))
# print(next(myiter))
# print(next(myiter))
# print(next(myiter))
